<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:e="http://org.el.func/SeamFunc"
                >
<a4j:region>
	<ol>

	
	    <!--
	    	********************************************************************************************************************
	    	UF
	    	********************************************************************************************************************
	     -->
		<li>
		  <s:div>
		      <s:decorate template="/layout/edit.xhtml" id="fieldCurso">
		        <ui:define name="label">
		          <h:outputText value="Curso"/>
		        </ui:define>
		        <h:selectOneMenu required="false" id="cmbCurso" styleClass="ComboFull"
		                         value="#{estruturaCursoSelect.curso}"
		                         requiredMessage="O campo 'Curso' é obrigatório."
		                         >
		          <s:selectItems var="curso" value="#{repositorioCurso.listar()}" noSelectionLabel="Selecione" label="#{curso.nome}"/>
		          <s:convertEntity/>
		          <a4j:support event="onchange" ajaxSingle="true" action="#{estruturaCursoSelect.limpaSelecionados}"
		          	reRender="fieldTurma,fieldAluno"/>
		        </h:selectOneMenu>
		      </s:decorate>
		  </s:div>
	    </li>
	  
	  	<li>
		 
		      <s:decorate template="/layout/edit.xhtml" id="fieldTurma" rendered="#{estruturaCursoSelect.curso!=null}">
		        <ui:define name="label">
		          <h:outputText value="Turma"/>
		        </ui:define>
		        <h:selectOneMenu required="false" id="cmbTurma" styleClass="ComboFull"
		                         value="#{estruturaCursoSelect.turma}"
		                         requiredMessage="O campo 'Turma' é obrigatório."
		                         >
		          <s:selectItems var="turma" value="#{estruturaCursoSelect.curso.turmasAtivas}" noSelectionLabel="Selecione" label="#{turma.nome}"/>
		          <s:convertEntity/>
		         <a4j:support event="onchange" ajaxSingle="true" action="#{estruturaCursoSelect.limpaSelecionados}"
		          	reRender="fieldAluno"/>
		        </h:selectOneMenu>
		      </s:decorate>
		
	    </li>
	    
	 
	    
	    <li>
		 
		      <s:decorate template="/layout/edit.xhtml" id="fieldAluno" rendered="#{estruturaCursoSelect.turma!=null}">
		        <ui:define name="label">
		          <h:outputText value="Aluno"/>
		        </ui:define>
		        <h:selectOneMenu required="false" id="cmbAluno" styleClass="ComboFull"
		                         value="#{estruturaCursoSelect.aluno}"
		                         requiredMessage="O campo 'Aluno' é obrigatório."
		                         >
		          <s:selectItems var="aluno" value="#{estruturaCursoSelect.turma.alunos}" noSelectionLabel="Selecione" label="#{aluno.nome}"/>
		          <s:convertEntity/>
		           <a4j:support event="onchange" ajaxSingle="true" 
		          	reRender="cmbAluno"/>
		        </h:selectOneMenu>
		      </s:decorate>
		
	    </li>

	</ol>


   		<a4j:status onstart="jQuery.blockUI({message:'Carregando...', centerY: 0,   overlayCSS:{backgroundColor:'#DCE2E9',opacity:0.9}})" onstop="jQuery.unblockUI()"/>
</a4j:region>

</ui:composition>
